Skip to content

fix: use federated graph id and org id to fetch operation content#2107

Merged
JivusAyrus merged 7 commits intomainfrom
suvij/eng-6195-use-the-fedgraphid-and-orgid-while-fetching-the-operation
Aug 8, 2025
Merged

fix: use federated graph id and org id to fetch operation content#2107
JivusAyrus merged 7 commits intomainfrom
suvij/eng-6195-use-the-fedgraphid-and-orgid-while-fetching-the-operation

Conversation

@JivusAyrus
Copy link
Copy Markdown
Member

@JivusAyrus JivusAyrus commented Aug 5, 2025

Summary by CodeRabbit

  • New Features

    • Added support for filtering and displaying operation content by federated graph name and namespace in relevant UI components.
    • Operation content queries now consider federated graph and namespace context for more precise results.
  • Bug Fixes

    • Improved query scoping to ensure operation content is correctly filtered by organization and federated graph.
  • Documentation

    • Updated request structure to include federated graph name and namespace for enhanced request specificity.

Checklist

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 5, 2025

Walkthrough

This change introduces two new fields, federatedGraphName and namespace, to the GetOperationContentRequest message in both the protobuf definition and its TypeScript implementation. Corresponding updates propagate these fields through backend SQL queries, repositories, and React component props, ensuring operation content queries are properly scoped by federated graph and namespace.

Changes

Cohort / File(s) Change Summary
Protobuf Message & TypeScript Bindings
proto/wg/cosmo/platform/v1/platform.proto, connect/src/wg/cosmo/platform/v1/platform_pb.ts
Added federatedGraphName and namespace fields to GetOperationContentRequest message and its generated TypeScript class.
Backend Query Logic
controlplane/src/core/bufservices/analytics/getOperationContent.ts, controlplane/src/core/repositories/CacheWarmerRepository.ts
Updated SQL queries and repository logic to filter operation content by OrganizationID and FederatedGraphID using the new request fields. Added validation and error handling for federated graph lookup.
Frontend Components – Propagation of New Fields
studio/src/components/checks/operation-content.tsx, studio/src/components/checks/operations.tsx, studio/src/components/checks/override.tsx
Extended props for OperationContent and OperationContentDialog components to include federatedGraphName and namespace, propagating these values from context and through component trees. Updated query enabling conditions accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

  • Moderate complexity due to the need to verify correct propagation of new fields across protocol, backend, and frontend layers, and to ensure query logic and component interfaces are properly updated.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3003fbc and fc104b3.

📒 Files selected for processing (1)
  • studio/src/components/checks/operation-content.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • studio/src/components/checks/operation-content.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: build_push_image
  • GitHub Check: image_scan
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: build_test
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: integration_test (./events)
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: build-router
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: build_push_image
  • GitHub Check: build_test
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch suvij/eng-6195-use-the-fedgraphid-and-orgid-while-fetching-the-operation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 5, 2025

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-6ba84fcecef65846418764a8e2c9d25fbfc2ed03

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
proto/wg/cosmo/platform/v1/platform.proto (1)

582-586: Consider declaring the new fields as optional and add doc-comments for consistency

GetOperationContentRequest now relies on federated_graph_name and namespace, but they are declared as plain string fields.
In proto3 this means:

  • No presence tracking – the backend cannot distinguish between “not provided” and “empty string”.
  • Call-sites must always transmit a (possibly empty) string, which easily leads to subtly broken filters.

Unless the service really needs empty-string semantics, make them explicitly optional and add short comments (as done on most neighbouring messages) to keep the schema self-documenting.

-  string federated_graph_name = 2;
-  string namespace = 3;
+  // FQDN of the federated graph whose operation content should be fetched
+  optional string federated_graph_name = 2;
+  // Namespace the graph belongs to
+  optional string namespace = 3;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7591878 and c754f04.

⛔ Files ignored due to path filters (1)
  • connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go is excluded by !**/*.pb.go, !**/gen/**
📒 Files selected for processing (7)
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts (2 hunks)
  • controlplane/src/core/bufservices/analytics/getOperationContent.ts (2 hunks)
  • controlplane/src/core/repositories/CacheWarmerRepository.ts (2 hunks)
  • proto/wg/cosmo/platform/v1/platform.proto (1 hunks)
  • studio/src/components/checks/operation-content.tsx (3 hunks)
  • studio/src/components/checks/operations.tsx (1 hunks)
  • studio/src/components/checks/override.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
studio/src/components/checks/operations.tsx (1)
studio/src/components/checks/operation-content.tsx (1)
  • OperationContentDialog (86-126)
controlplane/src/core/bufservices/analytics/getOperationContent.ts (1)
controlplane/src/core/repositories/FederatedGraphRepository.ts (1)
  • FederatedGraphRepository (96-1831)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: build-router
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: integration_test (./events)
  • GitHub Check: image_scan
  • GitHub Check: build_test
  • GitHub Check: build_test
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
connect/src/wg/cosmo/platform/v1/platform_pb.ts (2)

4514-4522: LGTM! Property definitions follow protobuf conventions.

The new string properties are correctly defined with appropriate TypeScript types, empty string defaults, and proper @generated JSDoc comments.


4533-4534: LGTM! Field descriptors are correctly structured.

The field descriptors properly define the new fields with sequential field numbers (2, 3), correct scalar string type, and appropriate snake_case naming convention for protobuf.

controlplane/src/core/repositories/CacheWarmerRepository.ts (1)

99-100: LGTM! Proper scoping implementation.

The addition of OrganizationID and FederatedGraphID filtering in the SQL query correctly implements the intended scoping to prevent cross-organization and cross-graph data access. The parameter integration is clean and follows existing patterns.

Also applies to: 119-121

studio/src/components/checks/operation-content.tsx (2)

24-25: LGTM! Clean prop propagation with proper validation.

The addition of federatedGraphName and namespace props correctly propagates the federated graph context. The conditional query enabling (enabled: enabled && !!federatedGraphName && !!namespace) is a good defensive practice that ensures the API call only happens when all required parameters are available.

Also applies to: 29-30, 38-42


89-90: LGTM! Consistent prop forwarding in dialog component.

The OperationContentDialog component properly accepts and forwards the new props to the OperationContent component, maintaining consistency in the component hierarchy.

Also applies to: 94-95, 117-122

controlplane/src/core/bufservices/analytics/getOperationContent.ts (3)

10-10: LGTM! Proper import for federated graph validation.

The import of FederatedGraphRepository enables proper validation of federated graph access permissions.


34-44: LGTM! Excellent security validation.

The federated graph validation ensures users can only access graphs within their organization scope. The error handling with descriptive messages (Federated graph '${req.federatedGraphName}' not found) provides good user feedback while maintaining security.


46-53: LGTM! Proper query scoping with performance optimization.

The SQL query correctly filters by both OrganizationID and FederatedGraphID to prevent data leakage. The addition of query cache settings (use_query_cache = true, query_cache_ttl = 2629800) is a good performance optimization for this type of lookup query.

Comment thread studio/src/components/checks/operations.tsx
Comment thread studio/src/components/checks/override.tsx
Copy link
Copy Markdown
Contributor

@StarpTech StarpTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JivusAyrus JivusAyrus merged commit cfe1036 into main Aug 8, 2025
51 of 52 checks passed
@JivusAyrus JivusAyrus deleted the suvij/eng-6195-use-the-fedgraphid-and-orgid-while-fetching-the-operation branch August 8, 2025 08:14
@Noroth Noroth mentioned this pull request Sep 30, 2025
5 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Nov 13, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants